class YHTimePicker {

    //操作中 初始化分钟
    changeTimeHourMinutesWithMinutes(hoursArray, minutesArray, firstTimeLatter) {
        if (!Number.isInteger(firstTimeLatter) || (0 == firstTimeLatter)) {
            console.error("FirstTimeLatter must be integer and not equal to serzo!");
            return;
        } else {
            if (0 != firstTimeLatter % 10) {
                console.error(" Ten is FirstTimeLatter's common number!");
                return;
            }
        }
        // console.log(typeof (firstTimeLatter) + "  " + Number.isInteger(firstTimeLatter) + "  " + firstTimeLatter);

        // testToday
        // const today = new Date(2019, 7, 31, 21, 16),
        var today = new Date(),
            tempOperateDay = new Date(today.getTime() + firstTimeLatter * 60 * 1000),
            tempOperateHour = tempOperateDay.getHours(),
            tempOperateMinute = Math.ceil(tempOperateDay.getMinutes() / 10);

        const showDayMinute = Math.ceil(today.getMinutes() / 10) * 10 + firstTimeLatter;
        const showDate = new Date(today.getFullYear(), today.getMonth(), today.getDate(), today.getHours(), showDayMinute);
        const showDateHour = showDate.getHours();
        const showDateMinute = parseInt((showDate.getMinutes() / 10));

        // console.log(`tody : ${today}   tempOperateDay:${tempOperateDay}  \n tempOperateHour : ${tempOperateHour}   tempOperateMinute : ${tempOperateMinute} `);
        for (var i = 0; i < 24; i++) {
            if (i >= showDateHour) {
                hoursArray.push(i + '点');
            }

        };
        for (var i = 0; i < 6; i++) {
            if (i >= showDateMinute) {
                minutesArray.push((i * 10) + '分');
            }

        };
        return new Date(showDate.getFullYear(), showDate.getMonth(), showDate.getDate(), 0, 0);
    }

    // 初始化 小时  分钟
    initBothHoursOrMiuteAsUsual(bol, options) {
        var hoursArray = options.hoursArray,
            minutesArray = options.minutesArray;

        if (bol) {
            for (var i = 0; i < 24; i++) {
                hoursArray.push(i + '点');

            };
            for (var i = 0; i < 6; i++) {
                i = i + '';
                i = i.length == 2 ? i : ('0' + i);
                minutesArray.push((i * 10) + '分');
            };
        } else {
            for (var i = 0; i < 6; i++) {
                i = i + '';
                i = i.length == 2 ? i : ('0' + i);
                minutesArray.push((i * 10) + '分');
            };
        }
    }


}

module.exports = YHTimePicker;